<template>
    <el-tabs v-model="activeTag">
        <el-tab-pane label="新增子课程" name="addCourse">
            <el-form ref="childAddCourseRef" :model="entity" :rules="rules" label-width="100px" size="medium" >
                <el-row style="margin-top: 30px;">
                    <el-col :span="12">
                        <el-form-item label="父课程" prop="parentName" style="width:100%">
                            <el-input v-model="entity.parentName" :disabled="true"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="子课程" prop="courseName" style="width:100%">
                            <el-input v-model="entity.courseName" placeholder="请输入课程名词"/>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
        </el-tab-pane>
    </el-tabs>
</template>

<script>
    export default{
        props:{
            entity:{
                type: Object,
                required: true
            },
            rules:{
                type: Object,
                required: true
            }
        },
        data(){
            return {
                activeTag:"addCourse"
            }
        },
        methods:{
            //重置表单
            reset(){
                this.$refs.childAddCourseRef.resetFields();
            },
            //校验表单
            validate(){
                let checkResult = true;
                this.$refs.childAddCourseRef.validate((valid) => {
                    checkResult = valid;
                })
                return checkResult;
            },
        }
    }
</script>

<style lang="scss" scoped>

</style>